package com.jxm.thread.demo2.creat2;

public class TestMyRunnable {
    public static void main(String[] args) {
        //创建自定义类对象  线程任务对象
        MyRunnable mr = new MyRunnable();
        //创建线程对象1
        Thread t1 = new Thread(mr, "长江1");
        t1.start();

		//创建线程对象2，注意两个线程传入的是同一个对象，可以实现数据共享
        Thread t2 = new Thread(mr, "长江2");
        t2.start();

        new Thread(()->{
            System.out.println("执行的操作: "+Thread.currentThread().getName());
        },"长江3").start();
    }
}
